package io;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;

public class CharStreamReadFile {

	public final static String filename = CreateFolder.foldername + File.separator + "char.txt";
	/**
	 * 字符读入文件
	 * @param args
	 */
	public static void main(String[] args) {
		
		File file = new File(filename);
		try {
			Reader r = new FileReader(file);
			char[] c = new char[100];
			int n = r.read(c);
			r.close();
			//\r\n 也是字符占长度
			System.out.println("读入的长度为："+n);
	        System.out.println("内容为"+new String(c,0,n));
	        
	        for (int i = 0; i < n; i++) {
				System.out.println(c[i]);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
